package br.com.wagnerfull.precoimovel.dao;

import android.database.sqlite.SQLiteDatabase;
import br.com.wagnerfull.precoimovel.cadastro.Configuracao;
import br.com.wagnerfull.precoimovel.cadastro.Entrada;
import br.com.wagnerfull.precoimovel.cadastro.Incc;
import br.com.wagnerfull.precoimovel.cadastro.ItemParametroCalculo;
import br.com.wagnerfull.precoimovel.cadastro.ParametroCalculo;
import br.com.wagnerfull.precoimovel.cadastro.Simulacao;
import br.com.wagnerfull.precoimovel.cadastro.Taxa;

public class DAOMobileFactory {

	public static DAO<EntidadeMobile> getDAO(String tabela,
			SQLiteDatabase database, Class<?> classe)
			throws InstantiationException, IllegalAccessException {
		if (classe.equals(Simulacao.class)) {
			return new DAOSimulacao(tabela, database,
					(Simulacao) classe.newInstance());
		} else if (classe.equals(Taxa.class)) {
			return new DAOTaxa(tabela, database, (Taxa) classe.newInstance());
		} else if (classe.equals(ParametroCalculo.class)) {
			return new DAOParametroCalculo(tabela, database,
					(ParametroCalculo) classe.newInstance());
		} else if (classe.equals(ItemParametroCalculo.class)) {
			return new DAOItemParametroCalculo(tabela, database,
					(ItemParametroCalculo) classe.newInstance());
		} else if (classe.equals(Configuracao.class)) {
			return new DAOConfiguracao(tabela, database,
					(Configuracao) classe.newInstance());
		} else if (classe.equals(Entrada.class)) {
			return new DAOEntrada(tabela, database,
					(Entrada) classe.newInstance());
		} else if (classe.equals(Incc.class)) {
			return new DAOIncc(tabela, database, (Incc) classe.newInstance());
		}
		return null;
	}

}
